//
// Created by liushuai on 2020/1/30.
//
#include "singleNumber.h"
<<<<<<< HEAD:cxx/algorithm/src/singleNumber.cc
int singleNumber(std::vector<int>& nums){
    std::map<int,int> counter;
    int result = 0;
    for(auto elem:nums){
        if(counter.count(elem)){
            counter[elem]+=1;
        }else{
            counter[elem] = 1;
        }
    }
    for(auto e:counter){
        if(e.second == 1)
            result = e.first;
    }

    return result;
=======
int singleNumber(std::vector<int>& nums) {
  std::map<int, int> counter;
  int result = 0;
  for (auto elem : nums) {
    if (counter.count(elem)) {
      counter[elem] += 1;
    } else {
      counter[elem] = 1;
    }
  }
  for (auto e : counter) {
    if (e.second == 1) result = e.first;
  }

  return result;
>>>>>>> dev:cxx/algorithm/common/src/singleNumber.cc
}
